import numpy as np
from matplotlib import pyplot as plt
plt.figure(figsize=(9,6))
n = 8
X = np.arange(n)+1

Y1=[0.16,0.14,0.15,0.17,0.14,0.14,0.15,0.16]

Y2=[0.17,0.16,0.18,0.18,0.18,0.17,0.16,0.17]
improve =plt.bar(X,Y1,width = 0.35,facecolor = 'lightskyblue',edgecolor = 'white')

traditional=plt.bar(X+0.35,Y2,width = 0.35,facecolor = 'yellowgreen',edgecolor = 'white')

for x,y in zip(X,Y1):
    plt.text(x+0.2, y+0.01, '%.2f' % y, ha='center', va= 'bottom')

for x,y in zip(X,Y2):
    plt.text(x+0.6, y+0.01, '%.2f' % y, ha='center', va= 'bottom')
plt.ylim(0,+0.3)
plt.title('Loss Rate Comparison')
plt.ylabel('Loss Rate')
plt.xlabel('Patient')
plt.legend((improve,traditional,),(u"Imporved LLE",u"LLE",))
plt.show()
plt.show()